package org.example.zsbback01.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.zsbback01.entity.Book;

import java.util.List;

@Mapper
public interface BookMapper {
    @Select({"<script>" ,
            "    <bind name=\"pattern\" value=\"'%' + _parameter + '%'\"/>" ,
            "    SELECT * FROM t_book" ,
            "    <where>" ,
            "        <if test=\"name != null and name!=''\">" ,
            "            name like  #{pattern}" ,
            "        </if>" ,
            "    </where>",
            "</script>",
    })
    List<Book> findAll(String name);
}
